// 检查用户登录状态
import axios from 'axios'
import useUserStore from '@/store/index.js'
import { storeToRefs } from 'pinia';
const checkLoginStatus = (success, failed) => {
  const store = useUserStore();
  const {username,token} = storeToRefs(store)
  if (token.value) {
    axios.defaults.headers['Authorization'] = `Bearer ${token.value}`;
    if (success) { success() }
  }
  else {
    if (failed) { failed() }
  }
}
export default checkLoginStatus